export function eduMessageBox1(Vue) {
    function emptyOrDefaut(value, defValue) {
        return _.isEmpty(value) ? defValue : value;
    }
    // 普通confirm
    Vue.prototype.$eduConfirm = function(msg, title, options) {
        msg = emptyOrDefaut(msg, this.$t('common.tips.beSure'));
        title = emptyOrDefaut(title, this.$t('message.confirm'));
        const option = _.extend(
            {
                distinguishCancelAndClose: false,
                closeOnClickModal: false,
                type: 'warning',
                iconClass: 'edu-icon-confirm',
                center: true,
                customClass: 'edu-message-box',
                confirmButtonText: this.$t('message.confirm'),
                cancelButtonText: this.$t('message.cancel')
            },
            options
        );
        return this.$confirm(msg, title, option);
    };
    // 删除确认
    Vue.prototype.$delConfirm = function(msg, title) {
        msg = emptyOrDefaut(msg, this.$t('message.areYouSureDelete'));
        title = emptyOrDefaut(title, this.$t('message.delete'));
        return this.$eduConfirm(msg, title, {
            iconClass: 'edu-icon-delete'
        });
    };
    // 添加确认
    Vue.prototype.$addConfirm = function(msg, title) {
        msg = emptyOrDefaut(msg, this.$t('message.areYouSureAdd'));
        title = emptyOrDefaut(title, this.$t('message.add1'));
        return this.$eduConfirm(msg, title, {
            iconClass: 'edu-icon-add'
        });
    };
    // Alert
    Vue.prototype.$eduAlert = function(msg, title, options) {
        msg = emptyOrDefaut(msg, '');
        title = emptyOrDefaut(title, this.$t('message.prompt'));
        const option = _.extend(
            {
                type: 'info',
                center: true,
                iconClass: 'edu-icon-notify',
                customClass: 'edu-message-box'
            },
            options
        );
        return this.$alert(msg, title, option);
    };
    // 没选择Alert
    Vue.prototype.$noSelectAlert = function(msg, title) {
        msg = emptyOrDefaut(msg, this.$t('common.pla.plsSelectRecord'));
        return this.$eduAlert(msg, title);
    };
    // 发布确认
    Vue.prototype.$rePublicComfirm = function(msg, title) {
        msg = emptyOrDefaut(msg, this.$t('message.areYouSureAdd'));
        title = emptyOrDefaut(title, this.$t('message.add1'));
        return this.$eduConfirm(msg, title, {
            iconClass: 'edu-icon-notify'
        });
    };
}
